import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目名称',
    align: 'center',
    dataIndex: 'itemName',
  },
  {
    title: '阶段实验方案',
    align: 'center',
    dataIndex: 'entrustId_dictText',
  },
  {
    title: '实验人员',
    align: 'center',
    dataIndex: 'userName',
    width:120
  },
  {
    title: '实验开始时间',
    align: 'center',
    dataIndex: 'itemStartTime',
  },
  {
    title: '实验截至时间',
    align: 'center',
    dataIndex: 'itemFinishTime',
  },
  {
    title: '复审人',
    align: 'center',
    dataIndex: 'auditName',
    width:120
  },
  {
    title: '项目状态',
    align: 'center',
    dataIndex: 'itemStatus',
    width:120
  },
  // {
  //   title: '完成时间',
  //   align: "center",
  //   dataIndex: 'itemFinishTime'
  // },
];

export const columnsBasic: BasicColumn[] = [
  {
    title: '字段名称',
    align: 'left',
    dataIndex: 'fieldName',
    key: 'fieldName',
  },
  {
    title: '排序',
    align: 'center',
    dataIndex: 'fieldSort',
    sorter: true,
    width: 150,
  },
];

export const columnsNorm: BasicColumn[] = [
  {
    title: '字段名称',
    align: 'left',
    dataIndex: 'fieldName',
  },
  {
    title: '排序',
    align: 'center',
    dataIndex: 'fieldSort',
    width: 150,
  },
];

export const columnsTarget: BasicColumn[] = [
  {
    title: '字段名称',
    align: 'left',
    dataIndex: 'fieldName',
    key: 'fieldName',
  },
  {
    title: '排序',
    align: 'center',
    dataIndex: 'fieldSort',
    key: 'fieldSort',
    width: 150,
  },
];

export const columnsPerson: BasicColumn[] = [
  {
    title: '字段名称',
    align: 'left',
    dataIndex: 'fieldName',
  },
  {
    title: '排序',
    align: 'center',
    dataIndex: 'fieldSort',
    width: 150,
  },
];

export const columnsMBasic: BasicColumn[] = [
  {
    title: '字段名称',
    align: 'left',
    dataIndex: 'fieldName',
    key: 'fieldName',
  },
  {
    title: '字段编码',
    align: 'left',
    dataIndex: 'fieldCode',
    key: 'fieldCode',
  },
  {
    title: '字段类型',
    align: 'left',
    dataIndex: 'fieldType',
    key: 'fieldType',
  },
];

export const columnsMTarget: BasicColumn[] = [
  {
    title: '字段名称',
    align: 'left',
    dataIndex: 'fieldName',
    key: 'fieldName',
  },
  {
    title: '字段编码',
    align: 'left',
    dataIndex: 'fieldCode',
    key: 'fieldCode',
  },
  {
    title: '字段类型',
    align: 'left',
    dataIndex: 'fieldType',
    key: 'fieldType',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '实验项目名称',
    field: 'itemName',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '实验人员',
    field: 'testPerson',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '项目状态',
    field: 'itemStatus',
    component: 'Input',
    colProps: { span: 6 },
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '实验项目名称',
    field: 'itemName',
    component: 'Input',
  },
  {
    label: '依据的标准名称',
    field: 'basisName',
    component: 'Input',
  },
  {
    label: '依据的标准编号',
    field: 'basisNum',
    component: 'Input',
  },
  {
    label: '限制范围',
    field: 'basisScope',
    component: 'Input',
  },
  {
    label: '依据附件',
    field: 'basisAtta',
    component: 'Input',
  },
  {
    label: '大类名称',
    field: 'bigTypeName',
    component: 'Input',
  },
  {
    label: '类别名称',
    field: 'midTypeName',
    component: 'Input',
  },
  {
    label: '班组',
    field: 'team',
    component: 'Input',
  },
  {
    label: '实验人员',
    field: 'testPerson',
    component: 'Input',
  },
  {
    label: '项目状态',
    field: 'itemStatus',
    component: 'Input',
  },
  {
    label: '完成时间',
    field: 'itemFinishTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
//实验人员
export const labUserColumns: BasicColumn[] = [
  {
    title: '姓名',
    align: 'center',
    dataIndex: 'realname',
    width: 80,
  },
  {
    title: '性别',
    align: 'center',
    dataIndex: 'sex',
    customRender: ({ text }) => {
      return render.renderDict(text, 'sex');
    },
    width: 75,
  },
  {
    title: '部门名称',
    align: 'center',
    dataIndex: 'orgCodeTxt',
    width: 100,
  },
  {
    title: '工号',
    align: 'center',
    dataIndex: 'workNo',
    width: 75,
  },
  {
    title: '职位名称',
    align: 'center',
    dataIndex: 'postText',
    width: 80,
  },
  {
    title: '当前项目数',
    align: 'center',
    dataIndex: 'num',
    width: 80,
  },
  {
    title: '人员ID',
    align: 'center',
    dataIndex: 'id',
    width: 180,
    ifShow: false,
  },
];
export const labTempColumns: BasicColumn[] = [
  {
    title: '项目名称',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '所属部门',
    align: 'center',
    dataIndex: 'team',
  },
  {
    title: '收藏',
    align: 'center',
    dataIndex: 'collect',
    width: 110,
  },
  // {
  //   title: '项目id',
  //   align: 'center',
  //   dataIndex: 'id',
  //   width: 100,
  // },
];
